import Vue from 'vue'
import VueRouter from 'vue-router'
import Template from '../global/template.vue'
/*主页*/
import Main from "../components/main.vue"
/*登录*/
import Login from "../components/longin/login.vue"
/*我的仪表盘*/
import MyHome from '../components/homePage/myHome.vue'
/*客户*/
import Anounce from '../components/customer-module/Anounce.vue'
import MainMenu from '../components/customer-module/MainMenu.vue'
import Order from '../components/customer-module/Order.vue'
import SaleChance from '../components/customer-module/view_SaleChance.vue'
import CustomerManage from '../components/customer-module/CustomerManage.vue'
import linkman_manage from '../components/customer-module/linkman_manage.vue'
import CustomerStatistics from '../components/customer-module/CustomerStatistics.vue'
import StatisticContent from '../components/customer-module/StatisticContent.vue'
import custInfor from '../components/customer-module/view_custInfor.vue'
import customerView from '../components/customer-module/customerView.vue'
import customer_follow_up from '../components/customer-module/customer_follow_up.vue'
import actionRecord from '../components/customer-module/view_actionRecord.vue'
import cvViewContract from '../components/customer-module/view_Contract.vue'
import view_clientFlow from '../components/customer-module/view_clientFlow.vue'
import add_customer_info from '../components/customer-module/add_customer_info.vue'
import add_linkman_info from '../components/customer-module/add_linkman_info.vue'
import linkman_table from '../components/customer-module/linkman_table.vue'
import impor from '../components/customer-module/import.vue'
/*售前 销售机会*/
import OppoIndex from '../components/presale/oppo_index.vue'
import Saleoppo from '../components/presale/saleoppo.vue'
import Actrecord from "../components/presale/actrecord.vue";
/*售中 合同*/
import ContractIndex from "../components/in_sale/contract_index.vue";
import Contract from "../components/in_sale/contract.vue";
/*权限*/
import Jurisdiction from "../components/systemSetup/jurisdiction.vue";
import DataDictionary from "../components/systemSetup/dataDictionary.vue";
import PersonalCenter from "../components/systemSetup/personalCenter.vue";

/*售后*/
import CustomerService from "../components/afterSale/CustomerService.vue";
import KnowledgeBase from "../components/afterSale/KnowledgeBase.vue";
import Complaint from "../components/afterSale/Complaint.vue";
import CustomerCare from "../components/afterSale/CustomerCare.vue";
import CusterSeverCtrl from '../components/afterSale/CusterSeverCtrl.vue';
import RepairCtrl from "../components/afterSale/RepairCtrl.vue";
import RepairSever from "../components/afterSale/RepairSever.vue";
import NewRepairSeverPage from "../components/afterSale/NewRepairSeverPage.vue";
import KnowledgeClassifyManager from "../components/afterSale/KnowledgeClassifyManager.vue";
import Complaint_detail from "../components/afterSale/Complaint_detail.vue";
import CustomerCare_detail from "../components/afterSale/CustomerCare_detail.vue";
import CustomerService_detail from "../components/afterSale/CustomerService_detail.vue";
import RepairSever_detail from "../components/afterSale/RepairSever_detail.vue";
import WeiStateManager from "../components/afterSale/WeiStateManager.vue";
import ServeTypeManager from "../components/afterSale/ServeTypeManager.vue";
import CareTypeManager from "../components/afterSale/CareTypeManager.vue";
/*产品*/
import Product from "../components/product_management/product.vue";
import Classily from "../components/product_management/classily.vue";
import ProductIndex from "../components/product_management/product_index.vue";
import ProChart from "../components/purchase/pro_chart.vue";
/*仓库*/
import Ware from "../components/product_management/ware.vue";
import OutWare from "../components/product_management/out_ware.vue";
import OutIndex from "../components/product_management/out_index.vue";
import InWare from "../components/product_management/in_ware.vue";
import InIndex from "../components/product_management/in_index.vue";
/*采购*/
import Purchase from "../components/purchase/purchase.vue";
import OrderIndex from "../components/purchase/order_index.vue";
import PurchaseOrder from "../components/purchase/purchase_order.vue";
import PurchaseIndex from "../components/purchase/purchase_index.vue";

Vue.use(VueRouter);

const routes = [
/*登录*/
    { path: "/login", component: Login, meta: { withoutLogin:true}},

    {
        // 主页导航，一级路由
        path: "/", component: Main,children: [
            { path: "/tem", component: Template },
            //我的仪表盘
            { path: "/", component: MyHome },
/*客户*/   { path: "/impor", component: impor },
            //客户信息管理
            { path: "/cusman", component: CustomerManage },
            //联系人管理
            { path: "/linkman_manage", component: linkman_manage ,children:[
                    { path: "/linkman_table", component: linkman_table}
                    ]
            },
            //客户统计
            { path: "/cus_statis", component: CustomerStatistics, children:[
                    { path: "/statistic_content", component: StatisticContent}
                ]},

            { path: "/customer_view", component: customerView ,children:[
                    //客户视图中的客户信息
                    { path: "/cust_infor", component: custInfor,children:[
                            //客户跟进
                            { path: "/cust_follup", component: customer_follow_up },
                        ]
                    },
                    //客户视图中的行为记录
                    { path: "/act_rec", component: actionRecord},
                    //客户视图中的销售机会
                    { path: "/sale-chance", component: SaleChance },
                    //客户视图中的合同
                    { path: "/cv-contract", component: cvViewContract },
                    //客户视图中的客户流程
                    { path: "/view_clientFlow", component: view_clientFlow}
                ]
            },
            { path: "/add_customer_info", component: add_customer_info },
            { path: "/add_linkman_info", component: add_linkman_info },
            { path: "/mainmenu", component: MainMenu, children: [
                    { path: "/order", component: Order },
                ]
            },
            { path: "/anounce", component: Anounce },
/*售前 销售机会*/
            { path: "/oppo-index", component: OppoIndex ,children:[
                    {path: "/", component: Saleoppo },
                    {path:"/oppo-detail",component: resolve => require(['../components/presale/oppo_detail'], resolve)}
                ]
            },
            //行动记录页面
            { path: "/actrecord", component: Actrecord },
/*售中 合同*/
            { path: "/contract-index", component: ContractIndex, children: [
                    { path: "/", component: Contract },
                    { path: "/contract-details", component: resolve => require(['../components/in_sale/contract_details.vue'], resolve) },
                    { path: "/template-contract", component: resolve => require(["../components/in_sale/print_contract"],resolve)},
                    { path: "/template", component: resolve => require(["../components/in_sale/template"],resolve)}
                ]
            },
/*权限*/
            { path: "/jurisdiction", component: Jurisdiction },
            { path: "/dataDictionary", component: DataDictionary },
            {path:"/personalCenter",component:PersonalCenter},
/*售后*/
            //维修总控台
            { path: "/repairctrl", component: RepairCtrl },
            //维修服务
            { path: "/repairsever", component: RepairSever },
            //维修详情页面
            { path: "/repairserve_detail", component: RepairSever_detail },

            //客户服务
            { path: "/customerservice", component: CustomerService },
            //客户服务详情表
            { path: "/customerservice-detail", component: CustomerService_detail },

            //知识库
            { path: "/knowledgebase", component: KnowledgeBase },

            //客户投诉
            { path: "/complaint", component: Complaint },
            //投诉详情
            { path: "/complaint-detail" ,  component: Complaint_detail},
            //客服总控台
            { path: "/custerseverctrl", component: CusterSeverCtrl },

            //客户关怀
            { path: "/customercare", component: CustomerCare },
            //关怀详情
            { path: "/customercare-detail" ,  component: CustomerCare_detail},
            //新增维修工单
            { path: "/newrepairseverpage", component: NewRepairSeverPage},
            //知识库类型管理
            { path: "/KCManager", component: KnowledgeClassifyManager},
            //维修状态管理
            { path: "/weiStateManager", component: WeiStateManager},
            //关怀状态管理
            { path: "/careTypeManager", component: CareTypeManager},
            //服务状态管理
            { path: "/ServeTypeManager", component: ServeTypeManager},

/*产品*/
            //产品分类
            { path: "/classily", component: Classily},
            //产品
            { path: "/product_index", component: ProductIndex,children: [
                    { path: "/", component: Product },
                    { path: "/product_detail", component: resolve => require(['../components/product_management/product_detail.vue'], resolve) }
                ]
            },
            {path:"/pro_chart",component:ProChart},
            //库存
            { path: "/ware", component: Ware },
            //出库
            { path: "/out_index", component: OutIndex, children: [
                    { path: "/", component: OutWare },
                    { path: "/out_detail", component:resolve => require(['../components/product_management/out_detail.vue'], resolve) }
                ]
            },
            //入库
            { path: "/in_index", component: InIndex, children: [
                    { path: "/", component: InWare },
                    { path: "/in_detail", component:resolve => require(['../components/product_management/in_detail.vue'], resolve) }
                ]
            },
            //采购
            { path: "/order_index", component: OrderIndex, children: [
                    { path: "/", component: PurchaseOrder },
                    { path: "/order_detail", component:resolve => require(['../components/purchase/order_detail.vue'], resolve) }
                ]
            },
            //申请采购
            { path: "/purchase_index", component: PurchaseIndex, children: [
                    { path: "/", component: Purchase },
                    { path: "/purchase_detail", component: resolve => require(['../components/purchase/purchase_detail.vue'], resolve) }
                ]
            },
/*数据字典*/
			{ path: "/data-dictionary", component: resolve => require(["../components/systemSetup/dataDictionary.vue"], resolve)}
        ]
	}
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes
});

export default router;
